package com.wens.baselibrary.view.fragment

import android.os.Bundle
import android.view.View
import com.trello.rxlifecycle4.components.RxFragment
import com.wens.baselibrary.present.BasePresent
import com.wens.baselibrary.view.BaseView

abstract class BaseFragment<P : BasePresent> : RxFragment(), BaseView {
    protected val present: P by lazy { createPresent() }

    override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        if (view != null) {
            initView(view.context)
            initData(view.context)
        }
    }

    protected abstract fun createPresent(): P
}